package com.chen.mapper;

import com.chen.popj.entity.ContestLeaderboard;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ContestLeaderboardMapper {

    /**
     * 用户报名时先添加比赛排行榜相关信息
     *
     * @param contestLeaderboardList
     */
    void save(List<ContestLeaderboard> contestLeaderboardList);

    /**
     * 根据比赛id和用户id和题目id修改排行榜信息
     *
     * @param contestLeaderboard
     */
    void update(ContestLeaderboard contestLeaderboard);

    /**
     * 获取比赛id用户比赛排行榜信息
     *
     * @param contestId
     * @return
     */
    @Select("select * from contest_leaderboard where contest_id = #{contestID} ")
    List<ContestLeaderboard> getByContestId(Integer contestId);
}
